package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;

import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



import java.util.List;

import static com.zzyl.common.utils.PageUtils.startPage;

//Bean 名称：指定控制器的 bean 名称，可以在其他地方通过这个名称引用该控制器。
//唯一性：确保在 Spring 容器中该控制器的 bean 名称是唯一的，避免命名冲突。
@RestController("memberNursingProjectController")
@Slf4j
@RequestMapping("/member/orders/project")
public class NursingProjectController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;
    /**
     * 查询护理项目列表
     */
    @GetMapping("/page")
    @ApiOperation("家属查询护理项目列表")
    public TableDataInfo page(NursingProject nursingProject)
    {
        startPage();
        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);
        return getDataTable(list);
    }

/**
     * 获取护理项目详细信息
     */
    @GetMapping(value = "/{id}")
    @ApiOperation("获取护理项目详细信息")
    @ApiImplicitParam(name = "id", value = "护理项目ID", required = true, type = "path", dataType = "Long")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(nursingProjectService.selectNursingProjectById(id));
    }
}
